<template>
  <div>
    <div class="topbar">
      <router-link
        v-for="(item, index) in list"
        :key="index"
        custom
        v-slot="{ navigate, isActive }"
        :to="item.url"
      >
        <div @click="navigate" :class="{ active: isActive }">
          {{ item.title }}
        </div>
      </router-link>
    </div>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [
        {
          title: "轮播图",
          url: "/home/zixun/lunbo",
        },
        {
          title: "文章",
          url: "/home/zixun/wenz",
        },
      ],
    };
  },
};
</script>

<style lang="less" scoped>
.topbar {
  width: 100%;
  height: 40px;
  background: white;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  div {
    width: 140px;
    height: 40px;
    border-radius: 0 0 50% 0;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
  }
  .active {
    background: blue;
    color: #fff;
  }
}
</style>
